package com.art.wisdom.impl.menus;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.art.wisdom.api.menus.IMenusService;
import com.art.wisdom.mapper.DishesTypeMapper;
import com.art.wisdom.model.DishesType;
import com.art.wisdom.util.Result;
import com.art.wisdom.util.ResultStatus;

/**
 * 
 * @author xiezhiwei
 * @email xiezhiwei0314@126.com
 * @date 2017-08-10
 * 
 */
@Service
public class MenusServiceImpl implements IMenusService {
	
	private Logger logger = LoggerFactory.getLogger(MenusServiceImpl.class);
	
	@Autowired
	private DishesTypeMapper dishesTypeMapper;
	
	@Override
	public Result<List<DishesType>> getMenusInfo(Long merchantId) {
		logger.info("商户ID merchantId={}",merchantId);
		Result<List<DishesType>> result = new Result<List<DishesType>>();
		try{
			List<DishesType> dishesTypeList = dishesTypeMapper.getMenusInfo(merchantId);
			result.setResult(ResultStatus.SUCCESS, dishesTypeList, "查询菜单信息成功");
		}catch (Exception e) {
			logger.error(e.getMessage());;
			result.setResult(ResultStatus.ERROR, null, "查询菜单列表失败");
		}
		return result;
	}

}
